script_enemy_main{

let outfit=6;
outfit=(128*outfit)-128;
let usespell=0;
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

let SEshotm8=("script\SoundEffects\shotm8.wav");

let GRboss=("\script\Images\CharacterSprites\Hotaru.png");

@Initialize{
	LoadSE("script\SoundEffects\shotm8.wav");

	LoadGraphic(GRboss);

	SetColor(255,160,200);
	Concentration01(90);
	SetColor(255,255,255);
	SetLife(10000);
	MagicCircle(false);
	SetInvincibility(120);
	SetX(GetCommonData("Boss2X"));
	SetY(GetCommonData("Boss2Y"));
	SetMovePosition03(rand(minx+50,cx-40),miny+rand(70,90),8,3);
}
	
@MainLoop{

SetCollisionB(GetX,GetY,16);

if((time+0)%200==0 && time>=60){
	if(GetPlayerX>minx+50 && GetPlayerX<cx-40){
	SetMovePosition01(GetPlayerX+rand(-30,30),miny+rand(70,90),1.5);
	}
	if(GetPlayerX<=minx+50){
	SetMovePosition01(minx+50+rand(15,30),miny+rand(70,90),1.5);
	}
	if(GetPlayerX>=cx-40){
	SetMovePosition01(cx-40-rand(15,30),miny+rand(70,90),1.5);
	}
}


if(GetCommonData("Difficulty")==3){

if((time+90)%180==0 && time>=360){
let angle=GetAngleToPlayer;
	loop(12){
	let speed=1.5;
	let color=100;
		loop(5){
		SetShotColor(255-color,255-color,255-color);
		CreateShot01(GetX,GetY-20,speed,angle,13,0);
		speed+=0.6;
		color-=100/7;
		}
	angle+=360/12;
	}
angle+=360/24;
	loop(12){
	let speed=1;
	let color=100;
		loop(5){
		SetShotColor(255-color,255-color,255-color);
		CreateShot01(GetX,GetY-20,speed,angle,13,0);
		speed+=0.6;
		color-=100/7;
		}
	angle+=360/12;
	}	
SetShotColor(255,255,255);
PlaySE(SEshotm8);
usespell=-20;
}

//		if(time%200==0){ CreateShot01(boss1x+10,boss1y-35,speed,angle,191,0);
//		if(time%200!=0){ CreateShot01(boss2x+10,boss2y-45,speed,angle,191,0);


} //Hard

//==================================================================

if(GetCommonData("Difficulty")==4){

if((time+75)%150==0 && time>=300){
let angle=GetAngleToPlayer;
	loop(24){
	let speed=1.25;
	let color=100;
		loop(7){
		SetShotColor(255-color,255-color,255-color);
		CreateShot01(GetX,GetY-20,speed,angle,13,0);
		speed+=0.6;
		color-=100/7;
		}
	angle+=360/24;
	}
SetShotColor(255,255,255);
PlaySE(SEshotm8);
usespell=-40;
}

} //Lunatic


time++;
frame++;

if(GetCommonData("UseSpell2")!=0){ usespell=GetCommonData("UseSpell2"); SetCommonData("UseSpell2",0); }
if(usespell>0){ usespell--; }
if(usespell<0){ usespell++; }

SetCommonData("Boss2X",GetX); SetCommonData("Boss2Y",GetY);
}

@DrawLoop{
	SetGraphicScale(1,1);
	SetTexture(GRboss);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetRenderState(ALPHA);

	if(usespell>=1){ SetGraphicRect(384,outfit,512,outfit+128); }
	if(usespell<=-1){ SetGraphicRect(512,outfit,640,outfit+128); }
	if(usespell==0){
		if(GetSpeedX<=0.5 && GetSpeedX>=-0.5){ SetGraphicRect(0,outfit,128,outfit+128); }
		else if(GetSpeedX<-0.5){ SetGraphicRect(128,outfit,256,outfit+128); }
		else if(GetSpeedX>0.5){ SetGraphicRect(256,outfit,384,outfit+128); }
	}
	DrawGraphic(GetX,GetY);
}

@Finalize{
	CreateEnemyFromFile("script\Functions\dispel.txt",GetX,GetY,0,0,"Hotaru");
}

}